#include "GlobalTimer.h"

float GlobalTimer::m_dTime = 0;
unsigned int GlobalTimer::m_lastFrameIndex = 0;
unsigned int GlobalTimer::m_thisFrameIndex = 0;
Timer GlobalTimer::m_timer;

bool GlobalTimer::Start()
{
	m_thisFrameIndex = (unsigned int)(m_timer.getTime().getMilliSecondsSinceStart());
	m_lastFrameIndex = m_thisFrameIndex;
	m_dTime = 0;
	return true;
}

void GlobalTimer::Update()
{
	m_timer.Update();
	m_lastFrameIndex = m_thisFrameIndex;
	m_thisFrameIndex = (unsigned int)(m_timer.getTime().getMilliSecondsSinceStart());
	m_dTime = ((float)(m_thisFrameIndex - m_lastFrameIndex))/1000.0f;
}

void GlobalTimer::Stop()
{
}

Time& GlobalTimer::getTime()
{
	return m_timer.getTime();
}